@svizzle/utils/[string-boolean]-[object-object]

Methods

(static) pickIfKeyWith() → {function}

Source:
Since:
  • 0.20.0

Return a function expecting an object and returning a new object with only the keys satisfying the provided predicate

Example
> keysStartWithA = pickIfKeyWith(makeStartsWith('a'))
> keysStartWithA({a: 1, aa: 2, b: 0, c: 0})
{a: 1, aa: 2}
> keysStartWithA({b: 0, c: 0})
{}
Parameters:
Type Description
predicate
Returns:
  • Object -> Object
Type
function

(static) skipIfKeyWith() → {function}

Source:
Since:
  • 0.20.0

Return a function expecting an object and returning a new object without the keys satisfying the provided predicate

Example
> keysDontStartWithA = skipIfKeyWith(makeStartsWith('a'))
> keysDontStartWithA({a: 1, aa: 2, b: 0, c: 0})
{b: 0, c: 0}
> keysStartWithA({b: 0, c: 0})
{b: 0, c: 0}
Parameters:
Type Description
predicate
Returns:
  • Object -> Object
Type
function